package com.gzx.plugin.tjzy.modular.sms.receipt.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gzx.plugin.tjzy.modular.sms.receipt.bo.GzxSmsReceiptQueryBo;
import com.gzx.plugin.tjzy.modular.sms.receipt.service.GzxSmsReceiptService;
import com.gzx.plugin.tjzy.modular.sms.receipt.vo.GzxSmsReceiptVo;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import vip.xiaonuo.common.pojo.CommonResult;

import java.util.Map;

/**
 * @author zjt
 * @description
 * @date 2025/3/11 17:29
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/tjzy/sms/receipt")
public class GzxSmsReceiptController {

    private final GzxSmsReceiptService smsReceiptService;

    @PostMapping("/pageList")
    public CommonResult<Page<GzxSmsReceiptVo>> pageList(@RequestBody GzxSmsReceiptQueryBo smsRecordQueryBo) {
        return CommonResult.data(smsReceiptService.pageList(smsRecordQueryBo));
    }

    @GetMapping("/getSendDetail")
    public CommonResult<String> getSendDetail(@RequestParam String batchNumber, @RequestParam String phone) {
        return CommonResult.data(smsReceiptService.getSendDetail(batchNumber, phone));
    }

    @GetMapping("/countByBatchNumber/{batchNumber}")
    public CommonResult<Map<String, Object>> getSendDetail(@PathVariable String batchNumber) {
        return CommonResult.data(smsReceiptService.countByBatchNumber(batchNumber));
    }
}
